<?php
$option = JRequest::getVar('option');
switch($option){
	/** frontend */
	case 'com_frcenter':
		$page = "Frontend - Center";
	break;

	case 'com_frclub':
		$page = "";
	break;

	case 'com_frtown':
		$page = "Frontend - Town";
	break;

	case 'com_frleader':
		$page = "Frontend - Leader";
	break;

	case 'com_frstatistic':
		$page = "Frontend - Statics";
	break;

	case 'com_frinformation':
		$page = "Frontend - Information";
	break;

	case 'com_fractivitive':
		$page = "Frontend - Activitive";
	break;

	case 'com_frdownload':
		$page = "Frontend - Download";
	break;

	case 'com_frquestion':
		$page = "Frontend - Questionare";
	break;

	case 'com_frmessage':
		$page = "Frontend - Message";
	break;

	/** backend */
	case 'com_users':
		$page = "Backend - Users";
	break;

	case 'com_information':
		$page = "Backend - Information";
	break;

	case 'com_center':
		$page = "Backend - Center";
	break;

	case 'com_town':
		$page = "Backend - Town";
	break;

	case 'com_info_leader':
		$page = "Backend - Leader";
	break;

	case 'com_statistic':
		$page = "Backend - Statics";
	break;

	case 'com_mail':
		$page = "Backend - Mail";
	break;

	case 'com_questionare':
		$page = "Backend - Questionare";
	break;

	case 'com_permission':
		$page = "Backend - Permission";
	break;

	case 'com_mail_group':
		$page = "Backend - Mail group";
	break;

	case 'com_activity':
		$page = "Backend - Activitive";
	break;

	case 'com_download':
		$page = "Backend - Download";
	break;

	default:
		$page = "Backend - Homepage";
}

$username = JFactory::getUser()->username;

$document = JFactory::getDocument();
$document->addScriptDeclaration("
	var _gaq = _gaq || [];

	_gaq.push(['_setAccount', 'UA-20000176-2']);
	_gaq.push(['_trackPageview']);

	_gaq.push(['_setAccount', 'UA-45658962-15']);
	_gaq.push(['_trackPageview']);

	_gaq.push(['_setCustomVar', 1, 'User ID', '$username', 2]);

	_gaq.push(['_setCustomVar', 2, 'Section', '$page', 2]);

	(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();

");